package cn.iocoder.yudao.module.system.dal.mysql.cameraevent;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.cameraevent.CameraEventDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.cameraevent.vo.*;

/**
 * 告警异常列表 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface CameraEventMapper extends BaseMapperX<CameraEventDO> {

    default PageResult<CameraEventDO> selectPage(CameraEventPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CameraEventDO>()
                .eqIfPresent(CameraEventDO::getEvent, reqVO.getEvent())
                .eqIfPresent(CameraEventDO::getStatus, reqVO.getStatus())
                .eqIfPresent(CameraEventDO::getEventStart, reqVO.getEventStart())
                .eqIfPresent(CameraEventDO::getEventEnd, reqVO.getEventEnd())
                .betweenIfPresent(CameraEventDO::getCurrentTime, reqVO.getCurrentTime())
                .eqIfPresent(CameraEventDO::getNetworkAlarmIndex, reqVO.getNetworkAlarmIndex())
                .betweenIfPresent(CameraEventDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(CameraEventDO::getCameraId, reqVO.getCameraId())
                .orderByDesc(CameraEventDO::getId));
    }

    default List<CameraEventDO> selectList(CameraEventExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CameraEventDO>()
                .eqIfPresent(CameraEventDO::getEvent, reqVO.getEvent())
                .eqIfPresent(CameraEventDO::getStatus, reqVO.getStatus())
                .eqIfPresent(CameraEventDO::getEventStart, reqVO.getEventStart())
                .eqIfPresent(CameraEventDO::getEventEnd, reqVO.getEventEnd())
                .betweenIfPresent(CameraEventDO::getCurrentTime, reqVO.getCurrentTime())
                .eqIfPresent(CameraEventDO::getNetworkAlarmIndex, reqVO.getNetworkAlarmIndex())
                .betweenIfPresent(CameraEventDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(CameraEventDO::getCameraId, reqVO.getCameraId())
                .orderByDesc(CameraEventDO::getId));
    }

}
